<?php
// header("Content-type: text/html; charset=utf-8");
/**
* 封装一个PDO类
*/
Class Model{
	// private $db_host;
	// private $db_databases;
	// private $db_username;
	// private $db_password;
	// public  $db_utf;
	function __construct($config=array()){
		$this->db_host = isset($config['DB_HOST']) ? $config['DB_HOST'] : C('DB_HOST');
		$this->db_databases = isset($config['DB_DATABASES']) ? $config['DB_DATABASES'] : C('DB_DATABASES');
		$this->db_username = isset($config['DB_USERNAME']) ? $config['DB_USERNAME'] : C('DB_USERNAME');
		$this->db_password= isset($config['DB_PASSWORD']) ? $config['DB_PASSWORD'] : C('DB_PASSWORD');
	}

	//查询方法语句
	function query($sql){
		$conn = mysqli_connect($this->db_host,$this->db_username,$this->db_password,$this->db_databases);
		if (mysqli_connect_errno($conn)){
			echo "链接MYSQL失败: " . mysqli_connect_error();
		}
		$res = $conn->mysqli_query($sql);

		return $res;
	}
}
	



?>